package com.hunter.applearn

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.hunter.applearn.activity.BaseActivity
import com.hunter.applearn.activity.LoginActivity
import com.hunter.applearn.activity.RegisterActivity
import com.hunter.applearn.databinding.ActivityMainBinding

class MainActivity : BaseActivity() {
    private lateinit var binding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()

        // 初始化 ViewBinding
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        // 添加日志检查绑定是否成功
        println("Binding root: ${binding.root}")
        println("btnLogin: ${binding.btnLogin}")
        println("btnRegister: ${binding.btnRegister}")

        // 用binding调用btnLogin，不用使用findViewById
        binding.btnLogin?.setOnClickListener {
            navigateTo(LoginActivity::class.java)
        }

        // 用binding调用btn_register，不用使用findViewById
        binding.btnRegister?.setOnClickListener {
            navigateTo(RegisterActivity::class.java)
        }

    }
}